package chen.web.back.client.account;

import chen.web.back.client.Entry;
import chen.web.back.client.EntrySelectionListener;
import chen.web.back.client.Workbench;

import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.ListView;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;

public class AccountNavigation extends ContentPanel implements ValueChangeHandler<String> {
	
	private Entry account = new Entry("帐号设置", "account");
	private Entry role = new Entry("角色设置", "role");
	private Entry permission = new Entry("权限设置", "permission");
	private Entry register = new Entry("注册流程", "register");
	private Entry password = new Entry("找回密码", "password");
	
	public AccountNavigation() {
		this.setHeading("帐号管理");
		this.getHeader().setStyleAttribute("font-size", "13px");
		this.setBodyBorder(false);

		ListView<Entry> list = new ListView<Entry>();
		ListStore<Entry> store = new ListStore<Entry>();
		store.add(account);
		store.add(role);
		store.add(permission);
		store.add(register);
		store.add(password);
		
		list.setStore(store);
		list.setDisplayProperty("name");
		list.setBorders(false);
		list.setStyleAttribute("color", "#416AA3");
		list.setStyleAttribute("text-indent", "1em");
		list.getSelectionModel().addSelectionChangedListener(new EntrySelectionListener());
		
		this.add(list);
		History.addValueChangeHandler(this);
		History.fireCurrentHistoryState();
	}

	@Override
	public void onValueChange(ValueChangeEvent<String> event) {
		// TODO Auto-generated method stub
		String url = event.getValue();
		if(role.getURL().equals(url)){

		} else if(permission.getURL().equals(url)){

		}
	}

/*	
	private List<ModelData> getData(){
		List<ModelData> list = new ArrayList<ModelData>();
		for(int i=0; i<3; i++){
			ModelData data = new BaseModelData();
			list.add(data);
		}
		list.get(0).set("name", "系统配置");
		list.get(1).set("name", "邮箱配置");
		list.get(2).set("name", "系统配置");
		return list;
	}*/

}
